<template>
  <div>
    <el-row>
      <el-col :span="24">
        <!-- 数据部分 -->
        <el-table :data="tableData" stripe border style="width: 100%" @selection-change="handleSelectionChange">
          <!-- <el-table-column type="selection" width="55">
            </el-table-column>
            <el-table-column
                    label="序号"
                    align="center"
                    width="100">
                    <template slot-scope="scope">
                            {{ scope.$index+1 }}
                    </template>
                  </el-table-column> -->
          <el-table-column prop="financeId" label="融资企业ID" align="center">
          </el-table-column>
          <el-table-column prop="coreId" label="核心企业ID">
          </el-table-column>
          <el-table-column prop="allFinancingAmount" label="总融资金额">
          </el-table-column>
          <el-table-column prop="nowFinancingAmount" label="已融资金额">
          </el-table-column>
          <el-table-column prop="financingLimit" label="融资期限">
          </el-table-column>
          <el-table-column prop="annualizedInterestRate" label="年化利率">
          </el-table-column>
          <el-table-column prop="financingProgress" label="融资进度">
          </el-table-column>
          <el-table-column prop="assetId" label="抵押资产ID">
          </el-table-column>
          <!-- <el-table-column prop="tenderImages" label="背书凭证">
            </el-table-column> -->
          <el-table-column prop="tenderImages" label="背书凭证" align="center" width="150">
            <template slot-scope="scope">
              <img :src="scope.row.tenderImages" style="width:150px">
            </template>
          </el-table-column>



          <!--     <el-descriptions-item>
      <template slot="label">
        <i class="el-icon-picture-outline"></i>
        营业执照照片
      </template>
      <img :src="serverUrl" style="width:200px; height:150px">
    </el-descriptions-item> -->


          <el-table-column prop="tenderIssuanceTime" label="发标时间">
          </el-table-column>
          <el-table-column prop="tenderStage" label="标的阶段">
          </el-table-column>
          <el-table-column prop="coreAuditResults" label="核心企业审核结果">
          </el-table-column>
          <el-table-column prop="platformAuditResults" label="平台审核结果">
          </el-table-column>
          <el-table-column prop="billingTime" label="起息时间">
          </el-table-column>
          <el-table-column prop="fullAudit" label="满标审核">
          </el-table-column>
          <el-table-column prop="overdueCompensation" label="逾期代偿">
          </el-table-column>
          <el-table-column prop="repaymentReview" label="还款审核">
          </el-table-column>
          <el-table-column prop="finalRepaymentTime" label="最终还款时间">
          </el-table-column>
          <el-table-column label="操作">

            <template slot-scope="scope">
              <!-- <el-button icon="el-icon-edit" circle @click="updateData(scope.row)"></el-button> -->
              <el-button icon="el-icon-delete" circle @click="deleteTender(scope.row.tenderId)"></el-button>
              <!-- <el-button icon="el-icon-plus" circle @click="authMenu(scope.row)"></el-button> -->
            </template>

          </el-table-column>

        </el-table>

      </el-col>
    </el-row>






    <el-row>
      <el-col :span="24" :offset="16">
   
        <!-- <span class="demonstration">完整功能</span> -->
        <el-pagination background :page-sizes="[5, 10, 20]" @prev-click="prevPage" @next-click="nextPage"
          @current-change="currentPage" @size-change="changePage" :page-size="pageSize" :current-page="pageNum"
          layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>

      </el-col>
    </el-row>

  </div>
</template>
  
<script>
export default {
  data() {
    return {
      size: '',
      activeName: 'first',
      EnterpriseName: '',
      pageNum: 1,
      pageSize: 5,
      total: 0,
      tableData: [],
      selectionData: [],
      data: [],

    }
  },

  methods: {

    deleteTender(id) {
      let jwt = localStorage.getItem('jwt')
      console.log(id)
      this.$axios.get('api/finance/tender/removeTender?id=' + id, { headers: { 'jwt': jwt } })
        .then(res => {
          console.log(res.data)
          if (res.data.code == 200) {
            this.$message({
              type: 'success',
              message: '删除成功!'

            });
            this.queryTender()
          } else {
            this.$message({
              type: 'info',
              message: '删除失败'
            });
          }
        })
    },

    prevPage(val) {
            this.pageNum = val;

            this.queryBtn();
        },

        nextPage(val) {
            this.pageNum = val;

            this.queryBtn();
        },
        changePage(val) {
            // alert(val)
            this.pageNum = val;
            this.pageSize = val;
            this.queryBtn();
        },
        currentPage(val) {
      // alert(val)
      this.pageNum = val;
      this.queryBtn();
    },
    queryBtn() {
      // this.pageNum = 1;
      this.queryTender();
    },
   

    queryTender() {
      let jwt = localStorage.getItem("jwt");
      let param = {};
      param.pageNum = this.pageNum;
      param.pageSize = this.pageSize;

      let data = {};
      param.data = data;
      let enterpriseId = localStorage.getItem("enterpriseId");
      data.financeId = enterpriseId;

      this.$axios.post('api/finance/tender/queryTenderInfoByPage', param, { headers: { 'jwt': jwt } })
        .then(res => {
          console.log(res.data);
          if (res.data.code == 200) {
            let pageData = res.data.data;
            this.tableData = pageData.list;
            this.pageNum = pageData.pageNum;
            this.pageSize = pageData.pageSize;
            this.total = pageData.total

          }
        })
    },
    handleSelectionChange(val) {
      //每行数据
      console.log(val);
      this.selectionData = val;
    },

  },
  created() {

    this.queryTender();

  }
}
</script>
  
  
<style scoped>
.el-row {
  margin-top: 20px;
}
</style>
  
  